<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script src="./crypto-js.js"></script>
  <script src="./aes.js"></script>
  <script src="./pad-zeropadding.js"></script>
 </head>

 <body>
  <script>
	var data = "qqq!";
	var key  = CryptoJS.enc.Latin1.parse('1234123412341324');
	var iv   = CryptoJS.enc.Latin1.parse('1234123412341234');

	//加密
	var encrypted = CryptoJS.AES.encrypt(data,key,{iv:iv,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding});

	
	//alert(encrypted);

    console.log(encrypted.toString());

	//解密
	var decrypted = CryptoJS.AES.decrypt(encrypted,key,{iv:iv,padding:CryptoJS.pad.ZeroPadding});
	console.log(decrypted.toString(CryptoJS.enc.Utf8));

	//alert(decrypted.toString(CryptoJS.enc.Utf8));
</script>
 </body>
</html>
